function g1 = static_g1(T, y, x, params, T_flag)
% function g1 = static_g1(T, y, x, params, T_flag)
%
% File created by Dynare Preprocessor from .mod file
%
% Inputs:
%   T         [#temp variables by 1]  double   vector of temporary terms to be filled by function
%   y         [M_.endo_nbr by 1]      double   vector of endogenous variables in declaration order
%   x         [M_.exo_nbr by 1]       double   vector of exogenous variables in declaration order
%   params    [M_.param_nbr by 1]     double   vector of parameter values in declaration order
%                                              to evaluate the model
%   T_flag    boolean                 boolean  flag saying whether or not to calculate temporary terms
%
% Output:
%   g1
%

if T_flag
    T = bbeffectivedemandmatchirf_order4.static_g1_tt(T, y, x, params);
end
g1 = zeros(27, 27);
g1(1,10)=(-(T(1)*y(21)*T(19)));
g1(1,12)=(-(T(2)*params(23)*y(27)*T(21)));
g1(1,21)=(-(T(1)*y(10)*T(19)));
g1(1,26)=1;
g1(1,27)=(-(T(2)*params(23)*y(12)*T(21)));
g1(2,2)=1;
g1(2,3)=(-1);
g1(2,10)=params(14)/y(18)-params(14);
g1(2,12)=(-y(25));
g1(2,18)=(-(y(10)*params(14)))/(y(18)*y(18));
g1(2,25)=(-y(12));
g1(3,2)=(-((1-params(6))/params(6)/(1-y(12))));
g1(3,12)=(-(y(2)*(1-params(6))/params(6)/((1-y(12))*(1-y(12)))));
g1(3,25)=1;
g1(4,1)=(-(params(24)*T(3)*T(4)*T(15)*T(16)));
g1(4,2)=(-(T(16)*params(24)*T(15)*T(4)*y(1)*getPowerDeriv(y(2),params(6),1)));
g1(4,8)=(-(T(16)*params(2)*getPowerDeriv(y(8),1/params(12),1)));
g1(4,12)=(-(T(16)*params(24)*T(15)*y(1)*T(3)*(-(getPowerDeriv(1-y(12),1-params(6),1)))));
g1(4,23)=1;
g1(5,8)=1;
g1(5,23)=(-T(23));
g1(6,11)=(-((-((y(26)+params(15))*(1-params(1))))/(y(11)*y(11))));
g1(6,12)=y(25);
g1(6,25)=y(12);
g1(6,26)=(-((1-params(1))/y(11)));
g1(7,10)=y(21)*y(19);
g1(7,11)=(-((-((y(26)+params(15))*params(1)))/(y(11)*y(11))));
g1(7,19)=y(21)*y(10);
g1(7,21)=y(10)*y(19);
g1(7,26)=(-(params(1)/y(11)));
g1(8,5)=y(10)*y(21)*y(16);
g1(8,10)=y(21)*y(16)*y(5);
g1(8,11)=(-((-((y(26)+params(15))*params(1)))/(y(11)*y(11))));
g1(8,16)=y(10)*y(21)*y(5);
g1(8,21)=y(10)*y(16)*y(5);
g1(8,26)=(-(params(1)/y(11)));
g1(9,4)=y(10);
g1(9,9)=(-(1+y(10)*(-T(18))));
g1(9,10)=1-(T(8)+y(10)*(-T(20)));
g1(10,4)=1;
g1(10,21)=(-(params(4)+params(5)/2*2*(y(21)-1)));
g1(11,5)=1;
g1(11,21)=(-params(5));
g1(12,8)=(-(params(2)*(-T(6))/(y(8)*y(8))*T(17)));
g1(12,20)=1;
g1(12,23)=(-(params(2)*T(17)*T(23)/y(8)));
g1(13,18)=(-y(20));
g1(13,20)=(-y(18));
g1(14,14)=(-(y(20)*y(17)*getPowerDeriv(y(14),(-1),1)));
g1(14,17)=(-(y(20)*T(9)));
g1(14,20)=(-(y(17)*T(9)));
g1(15,3)=(-(y(20)/y(13)));
g1(15,13)=(-((y(20)*y(13)-y(20)*(y(3)+y(13)))/(y(13)*y(13))));
g1(15,20)=(-((y(3)+y(13))/y(13)));
g1(16,14)=(-((1-params(16))*params(17)*T(22)/T(10)));
g1(16,17)=1/y(17)-params(16)*1/y(17);
g1(17,3)=1;
g1(17,9)=1;
g1(17,10)=params(14)*(1-1/y(18));
g1(17,12)=y(25);
g1(17,14)=y(26)*params(7)/2*T(22)*2*(T(10)-1);
g1(17,18)=params(14)*(-((-y(10))/(y(18)*y(18))));
g1(17,25)=y(12);
g1(17,26)=(-(1-T(11)));
g1(18,4)=(-(y(20)*(-y(16))/y(16)));
g1(18,9)=(-(y(20)*y(16)*(T(12)*1/y(10)+T(7)*params(8)*1/y(10)-T(18))/y(16)));
g1(18,10)=(-(y(20)*y(16)*(T(12)*(-y(9))/(y(10)*y(10))+T(7)*params(8)*(-y(9))/(y(10)*y(10))-T(20))/y(16)));
g1(18,16)=(-((y(16)*y(20)*(T(8)+T(7)*T(12))-y(20)*(y(21)*y(19)+y(16)*(T(8)+T(7)*T(12))))/(y(16)*y(16))));
g1(18,19)=(-(y(21)*y(20)/y(16)));
g1(18,20)=(-((y(21)*y(19)+y(16)*(T(8)+T(7)*T(12)))/y(16)));
g1(18,21)=(-(y(19)*y(20)/y(16)));
g1(19,9)=params(8)*1/y(10);
g1(19,10)=params(8)*(-y(9))/(y(10)*y(10));
g1(19,16)=(-1)/(y(16)*y(16));
g1(20,11)=(-((-params(13))/(y(11)*y(11))));
g1(20,14)=params(7)*(T(10)-1)*T(22)+T(10)*params(7)*T(22)-((T(10)-1)*y(20)*params(7)*T(22)+T(10)*y(20)*params(7)*T(22));
g1(20,20)=(-(T(10)*params(7)*(T(10)-1)));
g1(21,11)=(-y(26));
g1(21,15)=1;
g1(21,26)=(-(y(11)-1));
g1(22,3)=(-(1/y(13)));
g1(22,6)=1;
g1(22,13)=(-((y(13)-(y(3)+y(13)))/(y(13)*y(13))));
g1(23,3)=(-(2*(y(3)+y(13))/T(14)));
g1(23,7)=1;
g1(23,13)=(-((T(14)*2*(y(3)+y(13))-T(13)*2*y(13))/(T(14)*T(14))));
g1(24,6)=2*y(6);
g1(24,7)=(-1);
g1(24,22)=1;
g1(25,1)=1-params(19);
g1(25,24)=(-x(1));
g1(26,24)=1-params(20);
g1(27,27)=1-params(22);
if ~isreal(g1)
    g1 = real(g1)+2*imag(g1);
end
end
